import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { formatToDateTime } from '/@/utils/dateUtil';
import { isArray } from 'xe-utils';
export const columns: BasicColumn[] = [
  {
    title: '用户编号',
    dataIndex: 'id', // 用户id
    width: 120,
  },
  {
    title: '登录名称',
    dataIndex: 'userName',
    width: 100,
  },
  {
    title: '主机',
    dataIndex: 'ipAddr',
    width: 100,
  },
  {
    title: '登录地址',
    dataIndex: 'loginLocation',
    width: 120
  },
  {
    title: '操作系统',
    dataIndex: 'os',
    width: 120,
    sorter: true
  },
  {
    title: '浏览器',
    dataIndex: 'browser',
    width: 100,
    sorter: true
  },
  // {
  //   title: '部门',
  //   width: 150,
  //   dataIndex: 'deptNames',
  //   customRender: ({text}) => {
  //     if (text && isArray(text)) {
  //       return text.join(",")
  //     }
  //     return text
  //   }
  // },
  
  {
    title: '登录时间',
    dataIndex: 'loginTime',
    width: 160,
    customRender: ({text}) => {
      return formatToDateTime(Number(text))
    }
  }
];


export const searchFormSchema: FormSchema[] = [
  {
    label: '主机',
    field: 'ipAddr',
    component: 'Input',
  },
  {
    label: '用户名称',
    field: 'userName',
    component: 'Input'
  }
];
